<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>公务员平时考核系统管理-登录页面</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="static/css/font.css">
<link rel="stylesheet" href="static/css/xadmin.css">
<link rel="stylesheet" href="static/css/bootstrap.css">
<script type="text/javascript" src="static/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="static/lib/layui/layui.js"></script>
<script type="text/javascript" src="static/js/xadmin.js"></script>
<link rel="stylesheet" href="static/css/basic.css">
<link rel="stylesheet" href="static/css/login.css">
<script type="text/javascript" src="static/js/jQuery.js"></script>
<script type="text/javascript" src="static/js/basic.js"></script>
<script type="text/javascript" src="static/js/app.js"></script>
<script type="text/javascript" src="static/js/particles.js"></script>
</head>
<body>
	<div class="pagewrap">
		<div class="main" id="screen">
			<div class="login-page dsj-login">
				<div class="login-block">
					<div class="login-pop">
						<div class="login-body clearfix">
							<div class="login-info">
								<div class="form-error">
									<div class="msg-error" style="display: none">
										<i class="btn btn-error"></i> 用户名或密码错误
									</div>
								</div>
								<div class="form-list">
									<div class="li">
										<div class="ele-wrap">
											<input type="text"  id="username" name="username" lay-verify="required" class="layui-input"
												placeholder="请输入账号">
										</div>
									</div>
									<div class="li">
										<div class="ele-wrap">
											<input type="password"  id="password" name="password"  lay-verify="required" class="layui-input"
												placeholder="请输入密码">
										</div>
									</div>
									<div class="li">
										<div class="ele-wrap">
											<div class="code-img">
											  <a href="javascript:void(0);" onclick="VerificationCode();">
												 <img id="captchaImage" src="changeCode.do" style="height: 48px;width: 120px;"/>
												 </a>
											</div>
											<div class="proving-code">
											   <input id="identifyingcode" name="identifyingcode"  class="layui-input" lay-verify="required" placeholder="验证码" type="text"
               style="margin-right: 20px">
											</div>
										</div>
									</div>
									<div class="li">
										<div class="ele-wrap">
											<a class="btn btn-blue" href="javascript:;" id="login-btn">登 录</a>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				
			</div>
			<div id="particles-js"></div>
		</div>
	</div>
</body>
</html>
<script>
	$(function () {
		var winH = $(window).height();
		var starH = winH+50;
		var starW = 998/998*starH;
		$('.ico-star1').css({
			'height':starH+'px',
			'width': starW+'px'
		});
	});
	 // 更换验证码
    function VerificationCode() {
        $("#captchaImage").attr("src", "changeCode.do?timestamp=" + (new Date()).valueOf());
    }

    $("#login-btn").click(function(){
    	 var username = $("#username").val();
         var password = $("#password").val();
         var identifyingcode = $("#identifyingcode").val()

         if (username == ""){
             layer.msg("账号不能为空", {time: 2000, icon:5,anim: 6})
             $("#username").face()
             return false;
         }
         if (password == ""){
             layer.msg("密码不能为空", {time: 2000, icon:5,anim: 6})
             $("#password").face()
             return false;
         }
         if (identifyingcode == ""){
             layer.msg("验证码不能为空", {time: 2000, icon:5,anim: 6})
             $("#identifyingcode").face()
             return false;
         }

         //这是使用ajax的方式提交
         $.ajax({
             type: 'post',
             url: 'adminLogin.do',
             data: {
                 'username': username,
                 'password': password,
                 'identifyingcode': identifyingcode,
             },
             dataType: 'json',
             success: function (result) {
            	 if(result.code==100){
            		  window.location.href ="toPage.do?url=admin/index.html";
            	 }else{
            		layer.msg(result.message); 
            	 }
             }
         });
     });
       
</script>
